package com.exigen.performance.test.webapp.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import com.exigen.performance.test.webapp.domain.base.BaseEntity;

/**
 * Class that represent template entity.
 * 
 * @author Maksim Savchuk
 * 
 */
@Entity
@Table(name = "PERF_REQUEST_TEMPLATE")
public class RequestTemplateEntity extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2220219192320171485L;
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	@Column(name = "TEMPLATE_ID")
	private Long id;
	@Column(name = "TEMPLATE_NAME")
	private String templateName;
	@ManyToMany
	@LazyCollection(LazyCollectionOption.FALSE)
	@JoinTable(name = "PERF_TEMPLATE_TESTSUMMARY", joinColumns = { @JoinColumn(name = "TEMPLATE_ID", referencedColumnName = "TEMPLATE_ID") }, inverseJoinColumns = { @JoinColumn(name = "TESTSUMMARY_ID", referencedColumnName = "TESTSUMMARY_ID") })
	private List<TestSummaryEntity> testSummaries;

	@ManyToMany
	@LazyCollection(LazyCollectionOption.FALSE)
	@JoinTable(name = "PERF_TEMPLATE_TRANSACTION", joinColumns = { @JoinColumn(name = "TEMPLATE_ID", referencedColumnName = "TEMPLATE_ID") }, inverseJoinColumns = { @JoinColumn(name = "TRANSACTION_ID", referencedColumnName = "TRANSACTION_ID") })
	private List<TransactionEntity> transactions;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTemplateName() {
		return templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}

	public List<TestSummaryEntity> getTestSummaries() {
		return testSummaries;
	}

	public void setTestSummaries(List<TestSummaryEntity> testSummaries) {
		this.testSummaries = testSummaries;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public List<TransactionEntity> getTransactions() {
		return transactions;
	}

	public void setTransactions(List<TransactionEntity> transactions) {
		this.transactions = transactions;
	}

}
